const Service = require('egg').Service;

class ScService extends Service {
 async getmessage(){
  const { ctx } = this;
    const awesomeCaptain = await ctx.model.Captain.findOne({
        where: {
          name: "Jack"
        },
        include: ctx.model.Ship
      });
      // 现在 ship 跟着一起来了
      console.log('Name:', awesomeCaptain.name);
      console.log('Skill Level:', awesomeCaptain.skillLevel);
      console.log('Ship Name:', awesomeCaptain.Ship.name);
      console.log('Amount of Sails:', awesomeCaptain.Ship.amountOfSails);
      return 'success'
 }
}

module.exports = ScService;
